package com.lpb.spring.lpbspring.getway.rtc.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * @author linpengbo
 * @date 2023/3/1
 */
public enum EnumServiceSpecification {

    AUDIO(1, "Audio","音频"),
    /**
     * 服务大类
     */
    SD(2, "SD","标清"),
    /**
     * 服务小类
     */
    HD(3, "HD","高清"),

    /**
     * 超高清FullHD
     */
    FULLHD(4,"FullHD","超高清"),

    /**
     * 2K
     */
    TWO_K(5,"2K","2K"),

    /**
     * 4k
     */
    FOUR_K(6,"4k","4k");

    private Integer code;
    private String mark;
    private String desc;

    EnumServiceSpecification(int code, String mark,String desc) {
        this.code = code;
        this.mark=mark;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public String getMark() {
        return mark;
    }

    public static EnumServiceSpecification getEnumByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (EnumServiceSpecification status : EnumServiceSpecification.values()) {
            if (status.getCode().intValue() == code.intValue()) {
                return status;
            }
        }
        return null;
    }

    public static EnumServiceSpecification getEnumMark(String mark) {
        if (StringUtils.isBlank(mark)) {
            return null;
        }
        for (EnumServiceSpecification status : EnumServiceSpecification.values()) {
            if (mark.equals(status.getMark())) {
                return status;
            }
        }
        return null;
    }

}
